<template>
  <el-card class="reply-item">
    <div class="user-info">
      <router-link
        :to="{ name: `info-center`, params: { userId: zan.uid } }"
      >
      <avatar size="large" :user="zan"></avatar>
    </router-link>
      <div class="text">
        <router-link
        :to="{ name: `info-center`, params: { userId: zan.uid } }"
      >
        <div class="nickname">{{ zan.nickname }}</div>
      </router-link>
        <div class="reply-time">{{zan.createTime | myTime}}</div>
      </div>
    </div>
    <div class="message">赞了我的 {{ type }}</div>
    <div class="pre-info">
      <div class="my-reply" v-show="zan.replyContent">{{zan.replyContent}}</div>
      <router-link :to="{ name: `post`, params: { postId: zan.postId } }">
      <div class="title">{{ zan.title }}</div>
      </router-link>
    </div>
    <div class="footer">
      <router-link :to="{ name: `forum`, params: { id: zan.forumId } }">
      <div class="from">{{ zan.forumName}}</div>
    </router-link>

    </div>
  </el-card>
</template>
  
  <script>
import myTime from '@/filters/MyTime';

export default {
  props:['zan'],
  computed: {
    type() {
      return this.zan.type == 'post_like'?'文章':'评论'
    }
  },
};
</script>
  
  <style lang="less" scoped>
@import "@/assets/less/common.less";
.title,.my-reply {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reply-item {
  width: 550px;
  margin: 0 auto;
  margin-bottom: 20px;
}
.user-info {
  display: flex;
  .el-avatar {
    margin-right: 20px;
    height: 48px;
    width: 48px;
  }
  .text {
    font-size: 14px;
    line-height: 24px;
  }
}
.message {
  margin-top: 10px;
}
.pre-info {
  margin-top: 20px;
  .my-reply {
    margin-bottom: 5px;
    color: @regularText;
  }
  .title {
    background: #f5f7fa;
    color: @regularText;
    padding: 10px;
    border-radius: 5px;
  }
}

.footer {
  font-size: 14px;
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  .reply {
    cursor: pointer;
  }
}
</style>